package com.ziyueyuwen.xiniao.base;

import com.suyeer.basic.util.LogUtil;
import com.suyeer.cache.MemCachedUtil;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author jun 2018/11/28
 */
@Component
@EnableScheduling
public class SystemTask {

    private static final String TASK_TEST_KEY = "TASK_TEST_KEY";

    @Scheduled(cron = "0 0 1 * * ?")
    public void task1() {
        try {
            if (MemCachedUtil.isEnableRunTask(TASK_TEST_KEY)) {
                LogUtil.info("start task...");
            }
        } catch (Exception e) {
            LogUtil.error(e);
        }
    }

}

